import Vue from "vue";
import VueRouter from "vue-router";
import hello from "../components/HelloWorld.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "hello",
    component: hello,
    redirect: '/teacher',
  },
  {
    path: "/teacher",
    component: hello,
    meta: {title: '页面'},
    redirect: '/teacher/onepage',
    children: [
      {
        path: "onepage",
        name: "one",
        meta: {title: '页面一'},
        component: () => import("../components/page01.vue")
      },
      {
        path: "twopage",
        name: "two",
        meta: {title: '页面二'},
        component: () => import("../components/page02.vue")
      },
      {
        path: "threepage",
        name: "three",
        meta: {title: '页面三'},
        component: () => import("../components/page03.vue")
      },
    ]
  },
  {
    path: "/student",
    component: hello,
    meta: {title: 'm页面'},
    redirect: '/student/monepage',
    children: [
      {
        path: "monepage",
        name: "mone",
        meta: {title: 'm页面一'},
        component: () => import("../components/mpage01.vue")
      },
      {
        path: "mtwopage",
        name: "mtwo",
        meta: {title: 'm页面二'},
        component: () => import("../components/mpage02.vue")
      }
    ]
  },
  {
    path: "/about",
    name: "About",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
